Fedora 25
Sponsored Link

Configure NFS Client
2016/11/27
 
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [    NFS Server    ] |10.0.0.30 | 10.0.0.31| [    NFS Client    ] |
|    dlp.srv.world     +----------+----------+     www.srv.world    |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Configure NFS Client.
[root@www ~]#
dnf -y install nfs-utils
[root@www ~]#
vi /etc/idmapd.conf
# line 5: uncomment and change to your domain name

Domain =
srv.world
[root@www ~]#
systemctl start rpcbind

[root@www ~]#
systemctl enable rpcbind

[root@www ~]#
mount -t nfs dlp.srv.world:/home /home

[root@www ~]#
df -hT

Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs  2.0G     0  2.0G   0% /dev
tmpfs                   tmpfs     2.0G     0  2.0G   0% /dev/shm
tmpfs                   tmpfs     2.0G  568K  2.0G   1% /run
tmpfs                   tmpfs     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mapper/fedora-root xfs        15G  1.3G   14G   9% /
/dev/vda1               ext4      976M  131M  779M  15% /boot
tmpfs                   tmpfs     2.0G  4.0K  2.0G   1% /tmp
tmpfs                   tmpfs     396M     0  396M   0% /run/user/0
dlp.srv.world:/home     nfs4       15G  1.3G   14G   9% /home
# home directory from NFS server is mounted
[2] Configure NFS mounting on fstab to mount it when the system boots.
[root@www ~]#
vi /etc/fstab
/dev/mapper/fedora-root /                       xfs     defaults        0 0
UUID=7ff45846-749b-4997-a68f-6111e8a0f1d1 /boot ext4    defaults        1 2
/dev/mapper/fedora-swap swap                    swap    defaults        0 0
# add NFS mount's settings to the end
dlp.srv.world:/home /home                       nfs     defaults        0 0
[3] Configure auto-mounting. For example, set NFS directory on /mntdir.
[root@www ~]#
dnf -y install autofs
[root@www ~]#
vi /etc/auto.master
# add to the end

/-    /etc/auto.mount

[root@www ~]#
vi /etc/auto.mount
# create new : [mount point] [option] [location]

/mntdir -fstype=nfs,rw  dlp.srv.world:/home

[root@www ~]#
mkdir /mntdir

[root@www ~]#
systemctl start autofs

[root@www ~]#
systemctl enable autofs

# move to the mount point to make sure it normally mounted

[root@www ~]#
cd /mntdir

[root@www mntdir]#
total 0
drwx------. 2 fedora    fedora    83 Jun 22 13:55 fedora

[root@www mntdir]#
cat /proc/mounts | grep mntdir

/etc/auto.mount /mntdir autofs rw,relatime,fd=19,pgrp=1369,timeout=300,minproto=5,maxproto=5,direct,
pipe_ino=23063 0 0 dlp.srv.world:/home /mntdir nfs4 rw,seclabel,relatime,vers=4.2,rsize=524288,wsize=524288,
namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.31,local_lock=none,addr=10.0.0.30 0 0
 
Tweet